<UserControl x:Class="Debugger.AddIn.Visualizers.Graph.Drawing.PositionedGraphNodeControl"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
	xmlns:local="clr-namespace:Debugger.AddIn.Visualizers"
    >
	<UserControl.Resources>
		<ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="NodeControlResources.xaml" />
          </ResourceDictionary.MergedDictionaries>
       </ResourceDictionary>
	</UserControl.Resources>
	
    <aero:SystemDropShadowChrome>
    <StackPanel Orientation="Vertical">
    	
    	<Border x:Name="typeNameHeaderBorder" Background="#ddeeff" Height="20" Margin="1,0" BorderThickness="1,1,1,0" BorderBrush="DarkGray" HorizontalAlignment="Stretch" Padding="1">
    		<TextBlock Text="{Binding TypeName}"></TextBlock>
    	</Border>
    	
        <ListView Name="listView" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="200" Height="300">
            <ListView.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="#ddeeff"  Offset="0.0" />
                    <GradientStop Color="White" Offset="0.4" />
                    <GradientStop Color="White" Offset="0.8" />
                </LinearGradientBrush>
            </ListView.Background>
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                	<EventSetter Event="MouseEnter" Handler="ListViewItem_MouseEnter"></EventSetter>
                	<EventSetter Event="MouseLeave" Handler="ListViewItem_MouseLeave"></EventSetter>
                    <Setter Property="Background" Value="Transparent" />
                    <Setter Property="Margin" Value="0"></Setter>
                    <Setter Property="BorderThickness" Value="1" />
                    <Setter Property="Focusable" Value="false" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsNested}" Value="True">
                            <Setter Property="Foreground" Value="#666666"></Setter>
                            <Setter Property="FontStyle" Value="Italic"></Setter>
                        </DataTrigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="Azure" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style>
                            		<!--	<Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>	-->
                        	 		<Setter Property="FrameworkElement.Height" Value="1"/>
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                	    <!-- Databound item is ContentNode -->
                        <GridView.Columns>
                        	<!-- Expand button (either property or nested) -->
                            <GridViewColumn Header="Plus" Width="20" x:Name="columnExpander">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Margin="0 2 0 0">
                                            <ToggleButton x:Name="Expander" Margin="-6 0" IsChecked="{Binding IsExpanded}" Click="NestedExpandButton_Click" Padding="0"></ToggleButton>
                                            <ToggleButton x:Name="PropertyExpander" Margin="-6 0" IsChecked="{Binding IsPropertyExpanded}" Click="PropertyExpandButton_Click" Padding="0"></ToggleButton>
                                        </StackPanel>
                                    	<!-- Do this by converter, not Triggers! -->
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding Path=HasChildren}" Value="False">
                                                <Setter TargetName="Expander"
                                                    Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding Path=ShowExpandPropertyButton}" Value="False">
                                                <Setter TargetName="PropertyExpander"
                                                    Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        	<!-- Icon -->
                        	<GridViewColumn Header="Icon" Width="10" x:Name="columnMemberIcon" >
                                <GridViewColumn.CellTemplate>
                                	<DataTemplate>
                        				<Image Width="10" Height="10" Source="{Binding MemberIcon}" Margin="-6 0"></Image>
									</DataTemplate>
                                </GridViewColumn.CellTemplate>
                        	</GridViewColumn>
                        	<!-- Name -->
                            <GridViewColumn Header="Name" Width="60" x:Name="columnName">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                    	<StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Name}" FontWeight="{Binding IsPropertyExpanded, Converter={StaticResource BoolToBoldConverter}}"></TextBlock>
                                    	</StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        	 <!-- Text -->
                            <GridViewColumn Header="Value" Width="60" CellTemplate="{StaticResource valueColumnTemplate}" x:Name="columnText">
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
            </ListView.View>
        </ListView>
    </StackPanel>
    </aero:SystemDropShadowChrome>
</UserControl>